export const getSetting = ()=>{
  return new Promise((rev,rej)=>{
    wx.getSetting({
      complete: (res) => {rev(res)},
    })
  })
}

export const chooseAddress = ()=>{
  return new Promise((rev,rej)=>{
    wx.chooseAddress({
      complete: (res) => {},
      fail: (res) => {rej(res)},
      success: (result) => {rev(result)},
    })
  })
}

export const openSetting = ()=>{
  return new Promise((rev,rej)=>{
    wx.openSetting({
      complete: (res) => {rev(res)},
    })
  })
}

export const showModel = (title="请问是否删掉该商品？")=>{
  return new Promise((rev,rej)=>{
    wx.showModal({
      title,
      content: '是否删除该商品？',
      success (res) {
        if (res.confirm) {
          rev(true)
        } else if (res.cancel) {
          rev(false)
        }
      }
    })
  })
}